package com.iwinding.ladygg.utils;

import java.util.Calendar;

/**
 * Created by 82218 on 2017/7/27.
 */

public class DoubleClickUtil {
    public static final int MIN_CLICK_DELAY_TIME = 2000;

    private static class SingletonHolder {
        private static DoubleClickUtil instance = new DoubleClickUtil();
    }

    public DoubleClickUtil() {
    }

    public static DoubleClickUtil getInstance() {
        return DoubleClickUtil.SingletonHolder.instance;
    }

    private long lastClickTime = 0;


    public boolean isCaneClick() {
        long currentTime = Calendar.getInstance().getTimeInMillis();
        if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
            lastClickTime = currentTime;
            return true;
        }
        return false;
    }
}
